/**
 * Description
 *
 * Creation Date 18/12/2017
 * @author Candy
 */

import React, { PureComponent } from 'react';
import { View, Image, StyleSheet, Text, TouchableOpacity } from 'react-native';
import { screen, color } from '../utils';
import * as TextTool from './TextTool';
import GridItem from './GridItem';

const { H2, Small, Normal, H3, tip } = TextTool;

export default class productList extends PureComponent {
	constructor(props) {
		super(props)
	}


	toDetail = item => {
		const { navigation } = this.props;
		navigation.navigate('ProductDetail', {product: item})
	}

	render() {
		const { productList, title } = this.props;
		return (
			<View>
				{
					title && (
						<H2 title={title} color={color.black} style={{paddingBottom: 10, paddingTop: 10, paddingLeft: 10, paddingRight: 10 }} />
					)
				}
				<View>
					{
						productList && productList.map((item, index) => (
							<GridItem item={item} key={index} onPress={() => this.toDetail(item)} />
						))
					}
				</View>
			</View>
		)
	}
}

const styles = StyleSheet.create({
	container: {
	}
});
